package leetcode.tree;

/**
 * @author zhangjunfei
 * @date 2023/8/24 15:41
 */
public class L_226 {


    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return root;
        }
        invertTree(root.left);
        invertTree(root.right);
        TreeNode right = root.right;
        TreeNode left = root.left;
        root.left = right;
        root.right = left;
        return root;
    }

}
